import React from 'react';  
import { Navigate } from 'react-router-dom';  

const isAuthenticated = (): boolean => {  
    return localStorage.getItem('token') !== null;  
};  

const ProtectedRoute: React.FC<{ children: React.ReactNode }> = ({ children }) => {  
    return isAuthenticated() ? <>{children}</> : <Navigate to="/login" />;  
};  

export default ProtectedRoute;